#include <algorithm>
#include <cctype>
#include <functional>
#include <iostream>
#include <map>
#include<string>
#include <vector>
using namespace std;


struct Greater
{
    bool operator()(const pair<string, int>& k1, const pair<string, int>& k2)
    {
        return k1.second > k2.second || (k1.second == k2.second && k1.first < k2.first);
    }
};
int main() {
    string s;
    map<string, int>countmap;
    while (getline(cin, s))
    {
        for (int i = 0, j = 0; i < s.size(); i++)
        {
            if (s[i] == ' ' || s[i] == '.')
            {
                string t = s.substr(j, i - j);
                if (isupper(t[0]))
                    t[0] = tolower(t[0]);
                j = i + 1;
                countmap[t]++;
            }
        }
        vector<pair<string, int>>kvVec(countmap.begin(), countmap.end());
        sort(kvVec.begin(), kvVec.end(), Greater());
        for (int i = 0; i < kvVec.size(); i++)
        {
            cout << kvVec[i].first << ":" << kvVec[i].second << endl;
        }
    }
}
